The present invention relates to a dynamic image encoding apparatus for real-time recording a dynamic image in a storage medium of a fixed recording capacity at a variable bit rate. The invention more particularly relates to a dynamic image encoding apparatus capable of recording data of a dynamic image of a prescribed time within a prescribed capacity of the storage medium while maintaining a picture quality level.
Along with the popularization of the multi-media technology in recent years, dynamic image encoding apparatuses for carrying out variable bandwidth compression encoding such as MPEG (moving picture experts group) encoding system or the like have been frequently used. Regarding this encoding system, MPEG1 is prescribed in ISO13818 and MPEG2 is prescribed in ISO11172, for example.
FIG. 22 is a block diagram showing a structure of a conventional dynamic image encoding apparatus. Referring to FIG. 22, at first, an input original image 1 according to the NTSC system or the like to be coded and recorded is input to an input control section 2. Then, the input control section 2 time-filters and space-filters the input image to divide it into various kinds of pictures in the MPEG system including I picture (an intra-frame predicted image), P picture (a forward inter-frame predicted image) and B picture (a bi-directional inter-frame predicted image), rearranges the sequence of encoding and outputs input image data 3 divided into macro block units.
A movement detector 6 detects a movement of the P picture and the B picture based on the input image data 3 and inter-frame predicted image data 5 output from an image frame memory 4. Regarding the P picture and the B picture, an inter-frame subtractor 7 subtracts movement-compensated inter-frame predicted image data 5 from the input image data 3, and outputs a result to a DCT (a discrete cosine transformer) 9 as inter-frame differential data 8. Regarding the I picture, the inter-frame subtractor 7 sets the inter-frame predicted image data 5 to zero and outputs the input image data 3 to the DCT 9 as inter-frame differential data 8.
The DCT 9 discrete cosine transforms the inter-frame differential data and outputs a DCT output 10 to a quantizer 11. The quantizer 11 quantizes the DCT output 10 and produces a quantizer output 12. A variable length encoder 13 variable-length encodes the quantizer output 12, and outputs resultant bandwidth-compressed data as a transmission buffer input 14. On the other hand, in order to carry out a local decoding for generating inter-frame predicted images of subsequent image frames as an inter-frame predictive encoding according to differential pulse code modulation (DPCM) system, an inverse quantizer 15 inversely quantizes the quantizer output 12 and outputs a resultant inverse quantizer output 16 to an inverse discrete cosine transformer (an inverse DCT) 17. The inverse DCT 17 inversely discrete-cosine transforms the inverse quantizer output 16 and outputs a resultant inverse DCT output 18 to an inter-frame adder 19. The inter-frame adder 19 adds the inverse DCT output 18 and the inter-frame predicted image data 5, and stores a result in the image frame memory 4 as inter-frame added data 20. The inter-frame predicted image data of the I picture is zero.
A transmission buffer section 21 temporarily stores the transmission buffer input 14, and transmits it to a channel adapter or a storage medium 26 of a prescribed bit rate as a transmission buffer output 22 at a fixed bit rate in synchronism with a clock of a fixed bit rate clock 27. In this case, an encoding generated information quantity controller 109 controls a quantization step size 25 by using a transmission buffer status 23 from the transmission buffer section 21.
FIG. 24 shows a relationship between a bit rate and the quantization step size 25 of each input image data 3 by characteristics. Referring to FIG. 24, when the quantization step size 25 is made larger in an images having the same characteristics, the quantization becomes coarse and the picture quality of the coded image deteriorates. However, a small value is generated in a quantized result, and information quantity generated by a variable-length encoding decreases, resulting into a reduction in the bit rate. On the contrary, when the quantization step size 25 is made smaller, the quantization becomes fine and the picture quality of the coded image improves. However, a large value is generated in a quantized result and information quantity generated by the variable-length encoding increases, resulting into an increase in a bit rate. The input image data 3 has a range of characteristics from a large image having a largest generated information quantity with a fine image and a rapid movement as shown by the line 3a in FIG. 24, to an image having a smallest generated information quantity with a simple image and little movement as shown by the line 3c in FIG. 24. Usually, there exists, as a major portion, image input data of a standard generated information quantity as shown by the line 3b in FIG. 24.
FIG. 23 is a block diagram showing a detailed structure of the transmission buffer section 21 and the encoding generated information quantity controller 109. Referring to
FIG. 23, a generated information quantity counter 101 counts at all times the transmission buffer input 14 and outputs a generated information quantity (a number of bits) 102. A transmission information quantity counter 103 counts at all times the transmission buffer output 22 and outputs a transmission information quantity (a number of bits) 104. A subtractor 105 subtracts the transmission information quantity 104 from the generated information quantity 102 and outputs a buffer stored information quantity 106.
The generated information quantity 102, the transmission information quantity 104 and the buffer stored information quantity 106 are input into the encoding generated information quantity controller 109 as a transmission buffer status 23. The encoding generated information quantity controller 109 samples the input transmission buffer status 23 with registers 107, and determines a quantization step size with CPU 108 based on this transmission buffer status 23, and outputs a result as the quantization step size 25 to the quantizer 11 and the inverse quantizer 15.
When the buffer capacity of the transmission buffer 21a is B, for example, encoding is carried out in a quantization step size Q0 and information is stored until the buffer capacity reaches B/2. When the buffer capacity has reached B/2, transmission is started from this time at a fixed transmission bit rate R0. Thereafter, a differential obtained by subtracting the fixed transmission bit rate R0 from the generated bit rate R of the transmission buffer input 14 is time-integrated, and the differential is increased or decreased as a buffer stored quantity.
The CPU 108 calculates the following expression by assuming that an average during one second of the buffer stored information quantities 106 for each frame to be A:
Q(n+1)=Q(n)+(2A/Bxe2x88x921)xc2x7Q0xe2x80x83xe2x80x83(1)
Then, the CPU 108 controls to make the stored information quantity of the transmission buffer section 21 come closer to B/2. In the above expression, Q (n+1) represents a quantization step size of a frame (n+1), Q (n) represents a quantization step size of a frame n, and Q0 represents a constant. The CPU 108 carries out various controls such as the control of changing the ratio of the quantization step size 25 for each of the I picture, P picture and B picture.
FIG. 25 shows a relationship between a generated information quantity and a recording time according to the conventional dynamic image encoding apparatus. In FIG. 25, although the amount of changes are different depending on the time constant taken for averaging the buffer stored information quantity 106 for each frame, the bit rate deviates from a target bit rate to a large extent when the time constant is too large. Therefore, it is necessary to take a time constant within a range of a few seconds to a few tens of seconds.
However, according to the above-described conventional dynamic image encoding apparatus, when a transmission bit rate has been prescribed in advance, a signal is transmitted from the transmission buffer section 21 to match the prescribed transmission bit rate. Accordingly, the range of picture quality control is limited, and it is not possible to flexibly adapt to a storage medium such as a disk or the like that can record information at a desired variable bit rate. Thus, there has been a problem that it is not possible to store dynamic image of a prescribed time within a prescribed capacity of the storage medium.
Further, there has been a problem that in the case of carrying out a recording management of a storage medium for recording at a variable bit rate, it is difficult to clearly grasp the remaining recording time and the like because of the variable bit rate.
It is an object of the present invention to provide a dynamic image encoding apparatus which can accommodate dynamic image data in a proper picture quality within a prescribed time of a storage medium for recording at a variable bit rate and which facilitates recording management of the storage medium.
In one aspect of the invention, an obtaining unit obtains a recording capacity and a recording time of recorded information sequentially recorded on the storage medium, a calculating unit obtains a remaining recording capacity and a remaining recording time of the storage medium from the recording capacity and the recording time obtained by the obtaining unit, and calculates a target bit rate at and after the current time from the remaining recording capacity and the remaining recording time, and a control unit controls the variable bit rate to sequentially change its quantization step size to a quantization step size for maintaining a level not larger than the target bit rate.
In an another aspect of the invention, a division setting unit divides and sets a recording area of the storage medium into a plurality of divided recording areas, a obtaining unit obtains a recording capacity and a recording time of recorded information sequentially recorded in each of the divided recording areas, a calculating unit obtains a remaining recording capacity and a remaining recording time for each of the divided recording areas from the recording capacity and the recording time obtained by the obtaining unit, and calculates a target bit rate at and after the current time from the remaining recording capacity and the remaining recording time, and a control unit controls the variable bit rate to sequentially change its quantization step size to a quantization step size for maintaining a level not larger than the target bit rate.
In an another aspect of the invention, the division setting unit divides the recording area into a plurality of equally divided recording areas, and the variable bit rate is controlled to sequentially change its quantization step size to a quantization step size for maintaining not larger than the target bit rate.
In an another aspect of the invention, a setting unit sets a target bit rate in a predetermined prescribed recording time of recorded information sequentially recorded in the storage medium, a obtaining unit obtains a recording capacity and a recording time of recorded information sequentially recorded on the storage medium, a calculating unit calculate s an average bit rate of a current time from a recording capacity and a recording time obtained by the obtaining unit after starting the prescribed recording time, and a control unit controls the average bit rate to sequentially change its quantization step size to a quantization step size for maintaining a level not larger than the target bit rate for each of the prescribed recording time.
In an another aspect of the invention, the setting unit sets the target bit rate as a function of the target bit rate for the prescribed recording time, and the control unit controls the quantization step size so that a maximum generated information quantity between optional l recording positions becomes not larger than a maximum generated information quantity of the function.
In an another aspect of the invention, a first setting unit sets a lower limit bit rate for guaranteeing a picture quality of not lower than a first predetermined level, and the control unit forcibly controls at least the variable bit rate to sequentially change its quantization step size to a quantization step size for maintaining a level not smaller than the lower limit bit rate.
In an another aspect of the invention, a second setting unit sets an upper limit bit rate for making a picture quality to be maintained at a level not higher than a second predetermined level, and the control unit forcibly controls at least the variable bit rate to sequentially change its quantization step size to a quantization step size for maintaining a level not larger than the upper limit bit rate.
In an another aspect of the invention, a setting and inputting unit sets and inputs a desired picture quality, the control unit obtains a quantization step size corresponding to the desired picture quality set and input by the setting and inputting unit from a relationship table for storing a relationship between the desired picture quality and a quantization step size corresponding to the picture quality, and controls the encoding of the dynamic image by using the obtained quantization step size.
In an another aspect of the invention, an arithmetic unit calculates a recording capacity and a recording time for a case where information has been recorded on the storage medium based on a bit rate of a standard picture quality, and a display unit displays as output the recording capacity and the recording time calculated by the arithmetic unit.
In an another aspect of the invention, a converting unit obtains a recording capacity of the storage medium at the current time, and obtains a recording time corresponding to this recording capacity by conversion using a bit rate of the standard picture quality, and a time display unit displays as output the recording time obtained by conversion by the converting unit.